<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="../js/vue.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div id="root">
			<h2>今天{{time}}邹宜臻吃的是{{food1}}</h2>
			<button @click="change">切换食物</button>
		</div>
		<script type="text/javascript">
			const vm = new Vue({
				el: '#root',
				data: {
					isLunch: true,
					food: true
				},
				methods: {
					change() {
						this.isLunch = !this.isLunch
						this.food = !this.food
					}
				},
				computed: {
					time() {
						return this.isLunch ? '中午' : '晚上'
					},
					food1() {
						return this.food ? '臭豆腐' : '腐乳'
					}
				}
			})
		</script>
	</body>
</html>
